﻿using System;
using System.Configuration;

namespace CodeflowsHost.Configuration
{
	public class CodeflowHostConfigurationSection : ConfigurationSection
	{
		[ConfigurationProperty("batchSize", DefaultValue = 100)]
		public int BatchSize
		{
			get { return (int) this["batchSize"]; }
		}

		[ConfigurationProperty("leaseTime", DefaultValue = 10)]
		public int LeaseTime
		{
			get { return (int) this["leaseTime"]; }
		}

		[ConfigurationProperty("stopTimeout", DefaultValue = 30)]
		public int StopTimeout
		{
			get { return (int) this["stopTimeout"]; }
		}

		[ConfigurationProperty("interval", DefaultValue = 5)]
		public int Interval
		{
			get { return (int) this["interval"]; }
		}

		public static CodeflowHostConfigurationSection GetConfiguration()
		{
			return ConfigurationManager.GetSection("codeflows") as CodeflowHostConfigurationSection
			       ?? new CodeflowHostConfigurationSection();
		}
	}
}